<?php
header("content-type:text/html;charset=utf-8"); //设置编码

//解析config.ini文件
$config = parse_ini_file(realpath(dirname(__FILE__) . '/config/config.ini'));

$servername = $config["dbServername"];
$username = $config["dbUsername"];
$password = $config["dbPassword"];
$dbName = $config["dbName"];

//创建连接
$conn = new mysqli($servername, $username, $password, $dbName);

//检测连接
if (mysqli_connect_error()) {
    die("连接失败: " . $conn->connect_error);
}

$idStr = '1234';
$idArray = explode(",", $idStr);

foreach ($idArray as $id) {

    $sql = "SELECT member_id, member_pw FROM w_member where member_id =" . $id;
    $result = $conn->query($sql);

    if ($result->num_rows > 0) {
        // 输出数据
        while ($row = $result->fetch_assoc()) {
            if ($row["member_pw"]) {
                echo $row["member_id"] . " -- " . $row["member_pw"] . "<br>";
            }
            continue;
        }
    } else {
        continue;
    }
}
$conn->close();